<template>
	<view class='box'>
		<view class="boxCont">
			<view class="title">退款商品</view>

			<view class="centerCont">
				<view class="leftCont">
					<view class="image">
						<image :src="snapshot.img" mode="aspectFill"></image>
					</view>
					<view class="introduce">
						<view class="tit line-clamp2">{{snapshot.title}}</view>
						<view class="spec textOver">{{snapshot.specName}}</view>
					</view>
				</view>

				<view class="goodsPrice">
					<view class="price"> <text class="littleMon">￥</text>{{detail.realPrice}}</view>
					<view class="priceNum">x{{detail.count}}</view>
				</view>
			</view>
		</view>

		<view class="boxCont" style="padding-bottom: 0;">
			<view class="title">选择服务类型</view>

			<view class="severList" @click="goPage('./applyRefund',1)">
				<view class="leftCont">
					<text class="iconfont icon-tuikuan icon" style="font-size: 60rpx;"></text>
					<view class="rightTit">
						<view class="tit">我要退款 (无需退货)</view>
						<view class="detail">没收到货，或与卖家协商同意不用退货只退款</view>
					</view>
				</view>
				<text class="iconfont icon-xiangyou1"></text>
			</view>

			<view class="severList" @click="goPage('./returnGoods',2)">
				<view class="leftCont">
					<text class="iconfont icon-daifahuo icon"></text>
					<view class="rightTit">
						<view class="tit">我要退货退款</view>
						<view class="detail">已收到货，需要退还收到的货物</view>
					</view>
				</view>
				<text class="iconfont icon-xiangyou1"></text>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {},
				snapshot: {},
			}
		},
		onLoad(e) {
			const {
				item = {}
			} = e;
			this.detail = JSON.parse(decodeURIComponent(item));
			this.snapshot = this.detail.snapshot
			console.log("this.sna: ",this.snapshot);
			console.log("this.detail: ",this.detail);			
		},
		methods: {
			goPage(url, type) {
				let obj = {
					orderNum: this.detail.orderNum,
					type: 2, // 2团购商品
					status: type, //1:仅退款   2:退货退款
					realPrice: this.detail.realPrice,
					freightPrice:this.detail.freightPrice//运费
				}
				uni.navigateTo({
					url: `${url}?obj=${JSON.stringify(obj)}`
				})
			}
		},
	}
</script>

<style lang='scss' scoped>
	.box {
		padding: 20rpx;
	}

	.boxCont {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 20rpx;
		overflow: hidden;
		margin-bottom: 20rpx;

		.title {
			font-weight: bold;
			margin-bottom: 15rpx;
		}

		.centerCont {
			display: flex;
			justify-content: space-between;

			.leftCont {
				position: relative;
				height: 130rpx;
				width: 85%;


				.image {
					width: 130rpx;
					height: 130rpx;
					border-radius: 15rpx;
					border: 2rpx solid #eee;
					position: absolute;
					overflow: hidden;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.introduce {
					margin-left: 170rpx;
					line-height: 40rpx;

					.tit {
						font-size: 28rpx;
					}

					.spec {
						font-size: 25rpx;
						color: #b4b4b4;
					}
				}
			}

			.goodsPrice {
				.price {
					font-weight: bold;
				}

				.priceNum {
					font-size: 25rpx;
					color: #b4b4b4;
					text-align: right;
				}
			}

		}

		.severList {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 30rpx 0;

			.leftCont {
				display: flex;
				justify-content: space-between;
				align-items: center;
				position: relative;

				.icon-daifahuo {
					font-weight: bold;
				}

				.icon {
					position: absolute;
					font-size: 55rpx;
					color: #ef631f;
				}

				.rightTit {
					margin-left: 70rpx;
					line-height: 40rpx;

					.tit {
						font-weight: bold;
					}

					.detail {
						font-size: 25rpx;
						color: #b4b4b4;

					}
				}
			}
		}
	}
</style>
